<import file="block/common.html" name="url" :tpl_cfg="['urlName'=>$title,'backList'=>'返回列表']"/>
<div class="layui-fluid">
    <div class="layui-form">
		<div class="layui-form-item">
            <label class="layui-form-label required">栏目名称</label>
            <div class="layui-input-inline">
                <input type="text" name="name" lay-verify="required" lay-reqtext="名称不能为空" placeholder="请输入名称" value="<{$info['name']??''}>" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">本级排序</label>
            <div class="layui-input-inline">
                <input type="text" name="sort" placeholder="请输入本级排序数字" value="<{$info['sort']??''}>" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">本级栏目中的排序 数字如： 2 ，数字越小，越前</div>
        </div>
       
        <div class="layui-form-item">
            <label class="layui-form-label required">栏目模板</label>
            <div class="layui-input-inline layui-col-md4">
					<select name="theme" lay-verify="">
					 <option value="index.html">默认模板</option>
					<?php foreach($templist as $key=>$vo){?>
					  <option value="<{$vo}>" <?php if(!empty($info)){if($info['theme'] == $vo){echo "selected";}} ?>><{$vo}></option>
					<?php }?>
					</select>  
            </div>
            <div class="layui-form-mid layui-word-aux">留空为系统默认模板 制作模板放在： /app/index/view/default/video/ 下,直接填写 如: list_XX.html 即可</div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label required">图标</label>
            <div class="layui-input-inline" style="width:300px;">
               <input type="text" class="icoSelect" placeholder="选择图标" name="ico" value="<{$info['ico']??''}>" lay-verify="required" lay-reqtext="图标不能为空">
               
            </div>
            <span class="layui-form-mid layui-word-aux" id="iconame"><{$info['ico']??''}></span>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label required">显示条数</label>
            <div class="layui-input-inline">
                <input type="text" name="num" placeholder="请输入数字" value="<{$info['num']??''}>" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">前台栏目列表每页显示内容条数 数字如：25</div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
			<input type="hidden" name="id" value="<{$info['id']??''}>">
                <button class="layui-btn" lay-submit lay-filter="saveBtn"><i class="layui-icon">&#x1005;</i><?php echo lang('save');?></button>
            </div>
        </div>
    </div>
</div>
<script>
layui.define(["iconSelected"],function () {
        var form = layui.form,layer = layui.layer,colorpicker = layui.colorpicker,iconSelected = layui.iconSelected;

        iconSelected.render(".icoSelect", {
            event: {
                select(event, data) {
                    $('#iconame').text(data.icon);
                    //console.log("选中的图标数据", { event, data });
                },
            },
        });        

        form.render();

        form.on('submit(saveBtn)', function (data) {
			$.post('<{CAUrl("videocate",ROUTE["act"])}>',data.field,function(res){
                if(res.status == 1){
                    layer.msg(res.info, {icon: 1, time: 1000},function(){
						loadMain('<{CAUrl("videocate","index")}>');
					});
                }else{
                    layer.msg(res.info, {icon: 2, anim: 6, time: 5000});
                }
            });
            return false;
        });
    });
</script>